package com.hl.order.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hl.order.mapper.CouponsMapper;
import com.hl.order.domain.Coupons;
import com.hl.order.service.ICouponsService;

/**
 * 优惠券Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-07
 */
@Service
public class CouponsServiceImpl implements ICouponsService 
{
    @Autowired
    private CouponsMapper couponsMapper;

    /**
     * 查询优惠券
     * 
     * @param couponsId 优惠券主键
     * @return 优惠券
     */
    @Override
    public Coupons selectCouponsByCouponsId(Long couponsId)
    {
        return couponsMapper.selectCouponsByCouponsId(couponsId);
    }

    /**
     * 查询优惠券列表
     * 
     * @param coupons 优惠券
     * @return 优惠券
     */
    @Override
    public List<Coupons> selectCouponsList(Coupons coupons)
    {
        return couponsMapper.selectCouponsList(coupons);
    }

    /**
     * 新增优惠券
     * 
     * @param coupons 优惠券
     * @return 结果
     */
    @Override
    public int insertCoupons(Coupons coupons)
    {
        coupons.setCreateTime(DateUtils.getNowDate());
        return couponsMapper.insertCoupons(coupons);
    }

    /**
     * 修改优惠券
     * 
     * @param coupons 优惠券
     * @return 结果
     */
    @Override
    public int updateCoupons(Coupons coupons)
    {
        coupons.setUpdateTime(DateUtils.getNowDate());
        return couponsMapper.updateCoupons(coupons);
    }

    /**
     * 批量删除优惠券
     * 
     * @param couponsIds 需要删除的优惠券主键
     * @return 结果
     */
    @Override
    public int deleteCouponsByCouponsIds(Long[] couponsIds)
    {
        return couponsMapper.deleteCouponsByCouponsIds(couponsIds);
    }

    /**
     * 删除优惠券信息
     * 
     * @param couponsId 优惠券主键
     * @return 结果
     */
    @Override
    public int deleteCouponsByCouponsId(Long couponsId)
    {
        return couponsMapper.deleteCouponsByCouponsId(couponsId);
    }
}
